.product-form-container {
  min-height: 100vh;
  background: #f5f5f5;

  .custom-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.05);

    .nav-content {
      display: flex;
      align-items: center;
      height: 88rpx;
      padding: 0 24rpx;
    }

    .nav-back {
      width: 88rpx;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      padding: 10rpx;
    }

    .back-icon {
      width: 40rpx;
      height: 40rpx;
    }

    .nav-title {
      flex: 1;
      text-align: center;
      font-size: 34rpx;
      font-weight: 600;
      color: #333;
    }

    .nav-placeholder {
      width: 88rpx;
    }
  }

  .form-scroll {
    height: 100vh;
    box-sizing: border-box;
  }

  .card {
    background: #fff;
    margin: 20rpx;
    padding: 32rpx 28rpx;
    border-radius: 24rpx;
    box-shadow: 0 12rpx 36rpx rgba(0, 0, 0, 0.05);

    &:last-child {
      margin-bottom: 120rpx;
    }
  }

  .card-title {
    font-size: 32rpx;
    font-weight: 600;
    margin-bottom: 24rpx;
    color: #333;
  }

  .image-uploader {
    display: flex;
    flex-wrap: wrap;
    gap: 20rpx;

    .image-item {
      width: 210rpx;
      height: 210rpx;
      border-radius: 20rpx;
      background: #f6f7fb;
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;

      .preview {
        width: 100%;
        height: 100%;
        border-radius: 20rpx;
      }

      .remove-btn {
        position: absolute;
        top: -10rpx;
        right: -10rpx;
        width: 40rpx;
        height: 40rpx;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.65);
        color: #fff;
        text-align: center;
        line-height: 40rpx;
        font-size: 28rpx;
      }

      &.add-item {
        flex-direction: column;
        color: #777;
        border: 2rpx dashed #d8d8d8;

        .add-icon {
          font-size: 60rpx;
          line-height: 1;
        }

        .add-text {
          margin-top: 10rpx;
          font-size: 26rpx;
        }

        .add-sub {
          font-size: 22rpx;
          color: #aaa;
          margin-top: 4rpx;
        }
      }
    }
  }

  .helper-text {
    display: block;
    margin-top: 16rpx;
    font-size: 24rpx;
    color: #999;
  }

  .form-item {
    display: flex;
    align-items: center;
    margin-bottom: 28rpx;

    &:last-child {
      margin-bottom: 0;
    }

    &.switch-item {
      justify-content: space-between;
      
      .label-wrapper {
        flex: 1;
        display: flex;
        flex-direction: column;
        
        .label {
          width: auto;
          margin-bottom: 8rpx;
        }
        
        .label-desc {
          font-size: 24rpx;
          color: #999;
        }
      }
    }

    .label {
      width: 180rpx;
      font-size: 28rpx;
      color: #555;
    }

    .value {
      flex: 1;
      font-size: 28rpx;
      color: #111;

      &.placeholder {
        color: #bbb;
      }
    }

    .arrow {
      font-size: 40rpx;
      color: #ccc;
    }

    .input {
      flex: 1;
      font-size: 28rpx;
      padding: 12rpx 0;
      color: #111;
    }

    .counter {
      font-size: 24rpx;
      color: #999;
    }
  }

  .price-item {
    .price-wrapper {
      display: flex;
      align-items: center;

      .currency {
        font-size: 34rpx;
        font-weight: 600;
        margin-right: 6rpx;
      }

      .price-input {
        text-align: left;
      }
    }
  }

  .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24rpx;
    font-size: 30rpx;
    font-weight: 600;
    color: #333;

    .sub-text {
      font-size: 24rpx;
      font-weight: 400;
      color: #999;
    }
  }

  .textarea {
    width: 100%;
    min-height: 220rpx;
    background: #f8f8f8;
    border-radius: 20rpx;
    padding: 24rpx;
    box-sizing: border-box;
    font-size: 28rpx;
  }

  .textarea-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 16rpx;

    .counter {
      font-size: 24rpx;
      color: #aaa;
    }
  }

  .flavor-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12rpx;
    width: 100%;

    .flavor-chip {
      padding: 12rpx 24rpx;
      border-radius: 32rpx;
      background: #f3f4f6;
      font-size: 26rpx;
      color: #666;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 2rpx solid transparent;
      transition: all 0.2s;

      &.active {
        background: #e8f7ed;
        color: #2a9f5a;
        border-color: #5cb85c;
        font-weight: 500;
      }
    }
  }

  .flavor-groups {
    .flavor-group-item {
      margin-bottom: 40rpx;

      &:last-child {
        margin-bottom: 0;
      }

      .flavor-group-title {
        display: block;
        font-size: 28rpx;
        font-weight: 600;
        color: #333;
        margin-bottom: 20rpx;
      }

      .flavor-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 12rpx;

        .flavor-chip {
          padding: 12rpx 24rpx;
          border-radius: 32rpx;
          background: #f3f4f6;
          font-size: 26rpx;
          color: #666;
          display: inline-flex;
          align-items: center;
          justify-content: center;
          border: 2rpx solid transparent;
          transition: all 0.2s;
          cursor: pointer;

          &.active {
            background: #e8f7ed;
            color: #2a9f5a;
            border-color: #5cb85c;
            font-weight: 500;
          }
        }
      }
    }
  }

  .radio-group {
    display: flex;
    align-items: center;
    gap: 20rpx;

    .radio-item {
      display: flex;
      align-items: center;
      font-size: 26rpx;

      radio {
        transform: scale(0.9);
        margin-right: 6rpx;
      }
    }
  }

  /* 规格设置样式 */
  .spec-section {
    margin-top: 20rpx;
    padding-top: 20rpx;
    border-top: 1rpx solid #f0f0f0;
  }

  .spec-type-list {
    display: flex;
    flex-direction: column;
    gap: 16rpx;
    margin-top: 16rpx;
  }

  .spec-type-item {
    padding: 24rpx;
    border-radius: 16rpx;
    border: 2rpx solid #e8e8e8;
    background: #fafafa;

    &.active {
      border-color: #5cb85c;
      background: #f0f9f4;
    }

    .spec-type-name {
      display: block;
      font-size: 28rpx;
      font-weight: 600;
      color: #333;
      margin-bottom: 8rpx;
    }

    .spec-type-desc {
      display: block;
      font-size: 24rpx;
      color: #999;
    }
  }

  .spec-options-list {
    margin-top: 20rpx;
  }

  .spec-option-item {
    padding: 24rpx;
    border-radius: 16rpx;
    background: #fafbfc;
    border: 1rpx solid #e8e8e8;
    margin-bottom: 16rpx;

    &:last-child {
      margin-bottom: 0;
    }
  }

  /* 规格分组列表样式 */
  .spec-groups-list {
    margin-top: 16rpx;
  }

  .spec-group-item {
    padding: 24rpx;
    border-radius: 16rpx;
    background: #fafbfc;
    border: 1rpx solid #e8e8e8;
    margin-bottom: 16rpx;

    &:last-child {
      margin-bottom: 0;
    }
  }

  .spec-group-header {
    display: flex;
    align-items: center;
    gap: 16rpx;
    margin-bottom: 16rpx;

    .flavor-group-selector {
      flex: 1;
      display: flex;
      align-items: center;
      gap: 16rpx;
      cursor: pointer;
    }

    .flavor-checkbox {
      width: 40rpx;
      height: 40rpx;
      border: 2rpx solid #ddd;
      border-radius: 8rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
      flex-shrink: 0;

      &.checked {
        background: #5cb85c;
        border-color: #5cb85c;
      }

      .checkbox-icon {
        color: white;
        font-size: 28rpx;
        font-weight: bold;
      }
    }

    .spec-group-name-input {
      flex: 1;
      padding: 16rpx;
      border-radius: 12rpx;
      background: #fff;
      border: 1rpx solid #e8e8e8;
      font-size: 26rpx;
    }

    .spec-group-remove {
      font-size: 24rpx;
      color: #ff6b6b;
      padding: 8rpx 16rpx;
      white-space: nowrap;
    }
  }

  .spec-group-options {
    .spec-group-option {
      display: flex;
      align-items: center;
      gap: 12rpx;
      margin-bottom: 12rpx;

      &:last-child {
        margin-bottom: 0;
      }
    }

    .spec-option-chip {
      flex: 1;
      padding: 16rpx 24rpx;
      border-radius: 32rpx;
      background: #f3f4f6;
      border: 2rpx solid transparent;
      text-align: center;
      transition: all 0.2s;
      cursor: pointer;

      &.active {
        background: #e8f7ed;
        border-color: #5cb85c;
        
        .spec-option-chip-text {
          color: #2a9f5a;
          font-weight: 500;
        }
      }

      .spec-option-chip-text {
        font-size: 26rpx;
        color: #666;
      }
    }

    .spec-option-input {
      flex: 1;
      padding: 16rpx;
      border-radius: 12rpx;
      background: #fff;
      border: 1rpx solid #e8e8e8;
      font-size: 26rpx;
    }

    .spec-option-remove {
      font-size: 32rpx;
      color: #999;
      width: 48rpx;
      height: 48rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
      background: #f3f4f6;
      flex-shrink: 0;
    }
  }

  .add-spec-option-btn {
    margin-top: 12rpx;
    padding: 16rpx;
    text-align: center;
    border-radius: 12rpx;
    border: 2rpx dashed #5cb85c;
    color: #5cb85c;
    font-size: 26rpx;
    background: #f0f9f4;
  }

  .add-spec-group-btn {
    margin-top: 16rpx;
    padding: 20rpx;
    text-align: center;
    border-radius: 12rpx;
    border: 2rpx dashed #5cb85c;
    color: #5cb85c;
    font-size: 26rpx;
    background: #f0f9f4;
  }

  .spec-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16rpx;

    .spec-option-name {
      font-size: 28rpx;
      font-weight: 600;
      color: #333;
    }

    .spec-option-remove {
      font-size: 24rpx;
      color: #ff6b6b;
      padding: 8rpx 16rpx;
    }
  }

  .spec-option-inputs {
    display: flex;
    gap: 16rpx;
    align-items: flex-start;
  }

  .spec-option-input-group {
    flex: 1;
    min-width: 0; /* 确保flex子项可以正确缩小 */
    display: flex;
    flex-direction: column;

    .spec-input-label {
      font-size: 24rpx;
      color: #666;
      margin-bottom: 8rpx;
      white-space: nowrap;
    }

    .spec-price-input,
    .spec-stock-input {
      width: 100%;
      padding: 16rpx;
      border-radius: 12rpx;
      background: #fff;
      border: 1rpx solid #e8e8e8;
      font-size: 26rpx;
      box-sizing: border-box;
      height: 80rpx; /* 统一高度 */
    }
  }

  .spec-option-name-input {
    margin-top: 16rpx;

    .input {
      width: 100%;
      padding: 16rpx;
      border-radius: 12rpx;
      background: #fff;
      border: 1rpx solid #e8e8e8;
      font-size: 26rpx;
    }
  }

  .add-spec-option {
    margin-top: 16rpx;
    padding: 20rpx;
    text-align: center;
    border-radius: 12rpx;
    border: 2rpx dashed #5cb85c;
    color: #5cb85c;
    font-size: 26rpx;
    background: #f0f9f4;
  }

  /* 口味选择器样式 */
  .flavor-selector {
    margin-top: 20rpx;
    padding-top: 20rpx;
    border-top: 1rpx solid #f0f0f0;

    .flavor-options-container {
      margin-top: 12rpx;
    }

    .flavor-option-row {
      display: flex;
      align-items: center;
      gap: 12rpx;
      margin-bottom: 12rpx;

      &:last-child {
        margin-bottom: 0;
      }

      .spec-option-input {
        flex: 1;
        padding: 16rpx;
        border-radius: 12rpx;
        background: #fff;
        border: 1rpx solid #e8e8e8;
        font-size: 26rpx;
      }

      .flavor-select-chip {
        flex: 1;
        padding: 16rpx 24rpx;
        border-radius: 32rpx;
        background: #f3f4f6;
        border: 2rpx solid transparent;
        text-align: center;
        transition: all 0.2s;
        min-width: 120rpx;

        &.active {
          background: #e8f7ed;
          border-color: #5cb85c;
          
          .flavor-chip-text {
            color: #2a9f5a;
            font-weight: 500;
          }
        }

        .flavor-chip-text {
          font-size: 26rpx;
          color: #666;
        }
      }

      .spec-option-remove {
        font-size: 32rpx;
        color: #999;
        width: 48rpx;
        height: 48rpx;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: #f3f4f6;
        flex-shrink: 0;
      }
    }

    .selected-flavors {
      display: flex;
      flex-wrap: wrap;
      gap: 12rpx;
      margin-top: 12rpx;

      .flavor-tag {
        padding: 8rpx 20rpx;
        border-radius: 20rpx;
        background: #e8f7ed;
        color: #2a9f5a;
        font-size: 24rpx;
      }
    }

    .no-flavor-tip {
      margin-top: 12rpx;
      font-size: 24rpx;
      color: #999;
    }

    .flavor-select-btn {
      width: 100%;
      padding: 20rpx;
      border-radius: 12rpx;
      border: 2rpx dashed #5cb85c;
      color: #5cb85c;
      font-size: 28rpx;
      background: #f0f9f4;

      &::after {
        border: none;
      }
    }
  }

  .more-card {
    .more-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 28rpx;
      color: #333;
    }

    .more-body {
      margin-top: 20rpx;
    }
  }

  .form-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20rpx 24rpx;
    background: #fff;
    box-shadow: 0 -8rpx 20rpx rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 20rpx;

    .btn {
      flex: 1;
      height: 88rpx;
      border-radius: 44rpx;
      font-size: 30rpx;
      border: none;

      &::after {
        border: none;
      }

      &.ghost {
        background: #f4f6fb;
        color: #5b6477;
      }

      &.primary {
        background: linear-gradient(135deg, #5cb85c, #41a046);
        color: #fff;
      }
    }
  }

  /* 弹窗样式 */
  .modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000;
    padding: 40rpx 20rpx;
    box-sizing: border-box;
  }

  .category-modal,
  .service-modal {
    width: 100%;
    max-height: 90vh;
    background: #fff;
    border-radius: 32rpx 32rpx 0 0;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .modal-header {
    padding: 30rpx;
    font-size: 32rpx;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .header-actions {
      display: flex;
      align-items: center;
      gap: 20rpx;
    }

    .manage-btn {
      font-size: 26rpx;
      color: #5cb85c;
    }

    .close {
      font-size: 46rpx;
      color: #999;
      padding: 10rpx;
    }
  }

  .modal-search {
    display: flex;
    align-items: center;
    margin: 0 30rpx 20rpx;
    background: #f5f5f5;
    border-radius: 50rpx;
    padding: 10rpx 20rpx;

    input {
      flex: 1;
      font-size: 26rpx;
    }

    .clear {
      font-size: 32rpx;
      color: #999;
      padding: 4rpx 12rpx;
    }
  }

  .category-body {
    flex: 1;
    display: flex;
    border-top: 1rpx solid #f5f5f5;
    border-bottom: 1rpx solid #f5f5f5;

    /* 空状态样式 */
    .category-empty {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 100rpx 40rpx;

      .empty-icon {
        width: 200rpx;
        margin-bottom: 40rpx;
        opacity: 0.6;
      }

      .empty-title {
        font-size: 30rpx;
        font-weight: 600;
        color: #333;
        margin-bottom: 16rpx;
      }

      .empty-desc {
        font-size: 26rpx;
        color: #999;
        text-align: center;
        margin-bottom: 50rpx;
        line-height: 1.6;
      }

      .empty-btn {
        padding: 20rpx 60rpx;
        background: linear-gradient(135deg, #5cb85c, #41a046);
        color: #fff;
        border-radius: 44rpx;
        font-size: 28rpx;
        border: none;

        &::after {
          border: none;
        }
      }
    }

    .primary-list {
      width: 32%;
      background: #f8f8f8;
    }

    .secondary-list {
      flex: 1;
      padding: 0 20rpx;
    }

    .primary-item {
      padding: 28rpx;
      font-size: 26rpx;
      color: #666;

      &.active {
        color: #2a9f5a;
        background: #fff;
        font-weight: 600;
      }
    }

    .secondary-title {
      font-size: 26rpx;
      color: #444;
      padding: 22rpx 0;

      &.active {
        color: #2a9f5a;
      }
    }

    .tertiary-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 12rpx;
      padding-bottom: 20rpx;

      .tertiary-item {
        padding: 10rpx 22rpx;
        border-radius: 30rpx;
        background: #f3f4f6;
        font-size: 24rpx;
        color: #555;

        &.active {
          background: #e6f4ea;
          color: #2a9f5a;
        }
      }
    }
  }

  .modal-footer {
    display: flex;
    gap: 20rpx;
    padding: 24rpx 30rpx 40rpx;

    .btn {
      flex: 1;
      height: 80rpx;
      border-radius: 40rpx;
      font-size: 30rpx;
      border: none;

      &::after {
        border: none;
      }
    }

    .ghost {
      background: #f4f6fb;
      color: #5b6477;
    }

    .primary {
      background: #5cb85c;
      color: #fff;
    }
  }

  /* 口味选择器样式 */
  .flavor-selector {
    margin-top: 20rpx;
    padding-top: 20rpx;
    border-top: 1rpx solid #f0f0f0;

    .selected-flavors {
      display: flex;
      flex-wrap: wrap;
      gap: 12rpx;
      margin-top: 12rpx;

      .flavor-tag {
        padding: 8rpx 20rpx;
        border-radius: 20rpx;
        background: #e8f7ed;
        color: #2a9f5a;
        font-size: 24rpx;
      }
    }

    .no-flavor-tip {
      margin-top: 12rpx;
      font-size: 24rpx;
      color: #999;
    }

    .flavor-select-btn {
      width: 100%;
      padding: 20rpx;
      border-radius: 12rpx;
      border: 2rpx dashed #5cb85c;
      color: #5cb85c;
      font-size: 28rpx;
      background: #f0f9f4;

      &::after {
        border: none;
      }
    }
  }
}

/* 口味选择弹窗样式 */
.flavor-modal {
  width: 100%;
  max-height: 80vh;
  background: #fff;
  border-radius: 32rpx 32rpx 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);

  .flavor-modal-body {
    flex: 1;
    padding: 30rpx;
    overflow-y: auto;
    max-height: 60vh;

    .flavor-group {
      margin-bottom: 40rpx;

      &:last-child {
        margin-bottom: 0;
      }

      .flavor-group-title {
        display: block;
        font-size: 28rpx;
        font-weight: 600;
        color: #333;
        margin-bottom: 20rpx;
      }

      .flavor-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 12rpx;
      }
    }
  }
}

